import { ElMessage } from 'element-plus'

class ApiError extends Error {
  constructor (message, code) {
    super(message)
    this.code = code
  }

  showMessage (message) {
    ElMessage.error(message ?? this.message)
  }
}

export default ApiError
